<?php
require("includes/basic.php");
$taskid=$_REQUEST['t'];

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
	<HEAD>
		<TITLE> :: <?php echo $appName?> :: </TITLE>
		<link rel='stylesheet' type='text/css' href='style/admin.css'>
		<link rel='stylesheet' type='text/css' href='style/inner.css'>
		<script type='text/javascript' src='js/general.js'></script>
		<script type='text/javascript' src='js/help.js'></script>
		<script type='text/javascript' src='js/list.js'></script>
		<script type='text/javascript' src='js/jquery-latest.js'></script>
		<script type='text/javascript'>
		$(document).ready(function()
		{
			$('#listSelectAll').click(function()
			{
				$('#viewprojects').find(':checkbox').attr('checked', this.checked);

			});

			$("#deactivate").click(function()
			{
				var pid=$(':checkbox:checked').val();
				var dataString = 'pid='+ pid;
				
				$.ajax
				({
					type: "POST",
					url: "deactivate.php",
					data: dataString,
					cache: false,
					success: function()
					{
					$("#projects").html(projects.php);
					} 
				});
			});

			$("#activate").click(function()
			{
				var pid=$(':checkbox:checked').val();
				var dataString = 'pid='+ pid;
				$.ajax
				({
					type: "POST",
					url: "activate.php",
					data: dataString,
					cache: false,
					success: function()
					{
						
					$("#projects").html(projects.php);
					} 
				});
			});

			$("#assign").click(function()
			{
				var gpid=$(':checkbox:checked').val();
				var guid=$('#assignto').val();
				
				var dataString= 'gpid='+ gpid + '&guid='+ guid;
				$.ajax
				({
					type: "POST",
					url: "assign.php",
					data: dataString,
					cache: false,
					success: function(html)
					{	
						$("#projects").html(html);
					} 
				});
				if(gpid=="")
				{
					alert("Select project");
				}
			});		
		});
		</script>
		<script type='text/javascript'>
			function bodyLoad() {
				setContext("This is the main administration view.");
				setActiveItemByName("/");
				loadingOff();
				try {
					document.getElementById('loaderContainerH').height = wHeight();
				} catch (e) {}
			}
			function bodyUnload() {
				loadingOn();
			}
		</script>
	</HEAD>

	<body onLoad='bodyLoad();' onUnload='bodyUnload();'>
		<?php $pageName="List of Projects"; ?>
		<?php require("includes/header.php"); ?>

		<!-- devi : body content begins here -->

	<table border='0' cellspacing='0' cellpadding='0' id='loaderContainer' onClick='return false;'>
		<tr><td id='loaderContainerH'><div id='loader'>
			<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td>
				<p><img src='images/wait.gif' height='32' width='32' alt=''/>
				<strong>Please wait.<br>Loading ...</strong></p>
			</td></tr></table>
		</div></td></tr>
	</table>
	<?php 
	
			$taskid=$_REQUEST['t'];
			$q="select * from task_master where task_id=".$taskid;
			$q_result=mysql_query($q);
			$q_result_fetch=mysql_fetch_array($q_result);
			extract($q_result_fetch);
			$q_result_name=$q_result_fetch['task_title'];
	
	?>
	
	<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td id='screenH'>

		<div class='pathbar'><a href="index.php">Admin</a>->&nbsp;<a href="todo.php">To do List</a>&nbsp;->&nbsp;<?php echo $q_result_name;?></div>

		<div class='screenTitle'>
			<table width='100%' cellspacing='0'>
				<tr>
					<td>
						<?php echo "Task Details";?>
					</td>		
				</tr>
			</table>
		</div>
<!-- <table class="dialog" cellpadding="0" cellspacing="0"><tr><td>
<table class="dialogbox" cellpadding="0" cellspacing="0">
<tr><td> -->
<?php 
$class="evenrowbg";
?>
<!-- icons block area start -->
<!-- icons block area end -->
<!-- <div class="dialoghead" unselectable="on"></div><div class="dialogcontent" unselectable="on"> -->
<!-- dialogcontent start -->

<div class='help' id='helpae' onMouseOut="hMH('ae');">Click here to edit the selected group.</div>
<div class='hide' id='confae'>null</div>
<div class='help' id='helpau' onMouseOut="hMH('au');">Click here to add or remove users to this group.</div>
<div class='hide' id='confau'>null</div>
<div class='help' id='helpaa' onMouseOut="hMH('aa');">Click here to activate the selected group.</div>
<div class='hide' id='confaa'>Are you sure you want to activate the selected group?</div>
<div class='help' id='helpac' onMouseOut="hMH('ac');">Click here to deactivate the selected group.</div>
<div class='hide' id='confac'>Are you sure you want to deactivate the selected group?</div>
<div class='help' id='helpad' onMouseOut="hMH('ad');">Click here to delete the selected group.</div>
<div class='hide' id='confad'>null</div>
<div class='help' id='helpde' onMouseOut="hMH('de');">Click here to edit the selected group.</div>
<div class='hide' id='confde'>null</div>
<div class='listArea'>
<!-- 3D block start -->
<!-- <fieldset class="dialogblock"> -->
<!-- <legend><span class="textbold" unselectable="on">Task Details</span></legend> -->
		<!-- <table width='100%' cellspacing='0' cellpadding='0' border='0'>
			<tr><td> -->
			<!-- <table width='100%' cellspacing='0'>	
				<tr>
					<td align='left'>
						
					</td>
					<td class='misc'>
						&nbsp;
					</td>
				</tr>
			</table> -->

			<table>
<tr><td style="height:10px;">&nbsp;</td></tr>
</table>
						<table border="0" width="80%" style="border:1px solid #E0DFE3;" cellspacing="0" align="center">

						<tr><td colspan="2" align="left" style="border-bottom:1px solid #E0DFE3;padding:5px;font-weight:bold;font-size:13px;background-color:#E0DFE3;"><b>DISPLAY TASK</b></td></tr>
						<!-- <tr><td colspan="2" style="border-bottom:1px solid #E0DFE3;height:30px;"><a href="edit_task.php?id=<?php echo $taskid ?>">EDIT TASK</a></td></tr> -->

						<tr>
							<td class="open">Task</td>
							<td class="open_data">
								<?php 
								 
								 $q_result_desc=$q_result_fetch['task_description'];
								 $q_result_estimated=$q_result_fetch['estimated_time'];
								 $q_result_actual=$q_result_fetch['actual_time'];
								 echo $q_result_name;		 
								?></td>
						</tr>
						<tr>    <td class="open">Task Description</td>
								<td class="open_data">
								<?php
								echo $q_result_desc;
								?>
								</td>
						</tr>

						<tr>
								<td class="open">Task Files</td>
								<td class="open_data">
								<?php
								$doc=mysql_query("select task_doc_id, name from task_doc where task_id=".$taskid);
									if(mysql_num_rows($doc)>0)
										{
											//echo "<td>";
											while($docr=mysql_fetch_array($doc))
											{
												echo "<a href='download.php?id=".$docr['task_doc_id']."'>".$docr['name']."</a><br/>";
											}
											//echo "</td>";
										}
										else
										{
											echo "No Files";
										}
								?>
								
								</td>
						</tr>
						<tr>
								<td class="open">Task Project Files</td>
								<td class="open_data">
								<?php
									$doc1=mysql_query("select project_id, name from project_doc where project_id=".$taskid);
									if(mysql_num_rows($doc1)>0)
										{
											//echo "<td>";
											while($docr1=mysql_fetch_array($doc1))
											{
												echo "<a href='download.php?id=".$docr1['project_id']."'>".$docr1['name']."</a><br/>";
											}
											//echo "</td>";
										}
										else
										{
											echo "No Files";
										}
								?>
								</td>
						</tr>    
							
						<tr>    <td class="open">Task Assigned To</td>
								<td class="open_data">
								<?php 
								$q_assign="select * from task_assigned_to as t, user_master as u where t.task_assigned_to=u.user_id and t.task_id=".$taskid;
								$q_assign_res=mysql_query($q_assign);
								
									while($rw=mysql_fetch_array($q_assign_res))
									
									{//extract($rw);
									echo $rw['first_name'];
									}
							
								?>
								</td>
								
						</tr>    

						<tr>    
								<td class="open">Task Assigned By</td>
								<td class="open_data"> Project Manager
								<?php /*
								 $assignby="select * from task_assigned_to as t, customer_master as c where t.task_assigned_by=c.customer_id and t.task_id=".$taskid;
								$assignby_res=mysql_query($assignby);
								if(mysql_num_rows($assignby_res)>0)
								{
									while($rw1=mysql_fetch_array($assignby_res))
									{
									//extract($rw1);		
									//assignby=$rw1['cust_fname'];
									echo $rw1['cust_fname'];
									
									}
								}
								else { 	
								echo $taskid;
								$assignby=mysql_query("select * from task_assigned_to as t, user_master as u where t.task_assigned_by=u.user_id and t.task_id=".$taskid);
								
								if(mysql_num_rows($assignby)>0)
								{
									$r=mysql_fetch_array($assignby);
									extract($r);
									echo " asd".$r['first_name'];
								}
								}*/
								?></td>
						</tr>

						<tr>    
								<td class="open">Task Started On</td>
								<td class="open_data">
								<?php 
								$q_start="Select * from task_status where task_id=".$taskid;
								$q_start_res=mysql_query($q_start);
								$q_start_fetch=mysql_fetch_array($q_start_res);
								extract($q_start_fetch);
								$q_startOn=$q_start_fetch['task_started_on'];
								$q_endOn=$q_start_fetch['task_completed_on'];
								$q_status=$q_start_fetch['task_status'];
								//echo $q_startOn;
								?>
								
								</td>
						</tr>

						<!--<tr>    
								<td><strong>Task Ended On</strong></td>
							   <td><?php //echo $q_endOn;?> </td>
						</tr>-->

						<tr>    
								<td class="open">Status</td>
								<td class="open_data">
								<?php 
									if($q_status=='1')
									{
										echo "Open";
									}
									else
									{
										echo "close";
									}
								?>
								</td>
						</tr>

						<tr>    <td class="open">Estimated Time</td>
								<td class="open_data">
								<?php 
								echo $q_result_estimated;
								?>
								</td>
						</tr>    
						<tr>    <td class="open">Actual Time</td> 
								<td class="open_data">
								<?php 
								echo $q_result_actual;
								?>
							</td>
						</tr>    


						</table>
						</table>
			
<!-- </fieldset> -->

<!-- 3D block end -->
<!-- </div> -->


<!-- dialogcontent end -->     
<!-- </div> -->
<!-- </td></tr></table>
</td></tr></table>
<p>&nbsp;</p> -->
	<!-- </td></tr></table> -->

		<!-- devi : body content ends here -->
		
		<?php require("includes/footer.php"); ?>
	</BODY>
</HTML>
